<template>
  <div class="profile-container">
    <!-- 页面标题 -->
    <div class="page-header">
      <h1 class="page-title">
        <el-icon><User /></el-icon>
        个人资料
      </h1>
      <p class="page-description">管理您的个人信息和账户设置</p>
    </div>

    <el-row :gutter="24" class="profile-content" type="flex" align="top">
      <!-- 左侧：个人信息 -->
      <el-col :span="16" class="left-column">
        <!-- 基本信息卡片 -->
        <el-card class="info-card">
          <template #header>
            <div class="card-header">
              <div class="header-left">
                <el-icon class="header-icon"><UserFilled /></el-icon>
                <span class="header-title">基本信息</span>
              </div>
              <el-button
                type="primary"
                size="small"
                @click="handleEdit"
                :disabled="isEditing"
              >
                <el-icon><Edit /></el-icon>
                编辑资料
              </el-button>
            </div>
          </template>

          <el-form
            ref="profileFormRef"
            :model="profileForm"
            :rules="profileRules"
            label-width="90px"
            :disabled="!isEditing"
            class="profile-form"
          >
            <div class="form-section">
              <h4 class="section-title">基础信息</h4>
              <el-row :gutter="16">
                <el-col :span="12">
                  <el-form-item label="用户昵称" prop="nickname">
                    <el-input v-model="profileForm.nickname" placeholder="请输入用户昵称" />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="性别">
                    <el-select v-model="profileForm.gender" placeholder="请选择性别" style="width: 100%">
                      <el-option label="未知" :value="0" />
                      <el-option label="男" :value="1" />
                      <el-option label="女" :value="2" />
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
            </div>

            <div class="form-section">
              <h4 class="section-title">联系方式</h4>
              <el-row :gutter="16">
                <el-col :span="12">
                  <el-form-item label="手机号码" prop="phone">
                    <el-input v-model="profileForm.phone" placeholder="请输入手机号码" />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="邮箱地址" prop="email">
                    <el-input v-model="profileForm.email" placeholder="请输入邮箱地址" />
                  </el-form-item>
                </el-col>
              </el-row>
            </div>

            <div class="form-section">
              <h4 class="section-title">地址信息</h4>
              <el-row :gutter="16">
                <el-col :span="12">
                  <el-form-item label="省份">
                    <el-input v-model="profileForm.province" placeholder="请输入省份" />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="城市">
                    <el-input v-model="profileForm.city" placeholder="请输入城市" />
                  </el-form-item>
                </el-col>
              </el-row>
            </div>

            <div class="form-section">
              <h4 class="section-title">其他信息</h4>
              <el-form-item label="备注信息">
                <el-input
                  v-model="profileForm.remark"
                  type="textarea"
                  :rows="3"
                  placeholder="请输入备注信息"
                />
              </el-form-item>
            </div>

            <div class="form-actions" v-if="isEditing">
              <el-button type="primary" @click="handleSave" :loading="saving">
                <el-icon><Check /></el-icon>
                保存修改
              </el-button>
              <el-button @click="handleCancel">
                <el-icon><Close /></el-icon>
                取消
              </el-button>
            </div>
          </el-form>
        </el-card>

        <!-- 密码修改卡片 -->
        <el-card class="password-card">
          <template #header>
            <div class="card-header">
              <div class="header-left">
                <el-icon class="header-icon"><Lock /></el-icon>
                <span class="header-title">密码修改</span>
              </div>
            </div>
          </template>

          <el-form
            ref="passwordFormRef"
            :model="passwordForm"
            :rules="passwordRules"
            label-width="90px"
            class="password-form"
          >
            <el-row :gutter="16">
              <el-col :span="12">
                <el-form-item label="当前密码" prop="currentPassword">
                  <el-input
                    v-model="passwordForm.currentPassword"
                    type="password"
                    placeholder="请输入当前密码"
                    show-password
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="16">
              <el-col :span="12">
                <el-form-item label="新密码" prop="newPassword">
                  <el-input
                    v-model="passwordForm.newPassword"
                    type="password"
                    placeholder="请输入新密码"
                    show-password
                  />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="确认密码" prop="confirmPassword">
                  <el-input
                    v-model="passwordForm.confirmPassword"
                    type="password"
                    placeholder="请再次输入新密码"
                    show-password
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <div class="form-actions">
              <el-button type="primary" @click="handlePasswordChange" :loading="changingPassword">
                <el-icon><Lock /></el-icon>
                修改密码
              </el-button>
              <el-button @click="resetPasswordForm">
                <el-icon><Refresh /></el-icon>
                重置
              </el-button>
            </div>
          </el-form>
        </el-card>
      </el-col>

      <!-- 右侧：头像和统计信息 -->
      <el-col :span="8" class="right-column">
        <!-- 头像卡片 -->
        <el-card class="avatar-card">
          <template #header>
            <div class="card-header">
              <div class="header-left">
                <el-icon class="header-icon"><Upload /></el-icon>
                <span class="header-title">头像设置</span>
              </div>
            </div>
          </template>
          <div class="avatar-section">
            <div class="avatar-display">
              <el-avatar
                :size="100"
                :src="getImageUrl(profileForm.avatarUrl)"
                :icon="UserFilled"
              />
            </div>
            <div class="avatar-info">
              <p class="avatar-name">{{ profileForm.nickname || '未设置昵称' }}</p>
              <el-tag :type="profileForm.userType === 1 ? 'danger' : 'primary'" size="small">
                {{ profileForm.userType === 1 ? '管理员' : '普通用户' }}
              </el-tag>
            </div>
            <div class="avatar-actions">
              <el-button size="small" type="primary" @click="handleAvatarUpload">
                <el-icon><Upload /></el-icon>
                更换头像
              </el-button>
            </div>
          </div>
        </el-card>

        <!-- 账户状态卡片 -->
        <el-card class="status-card">
          <template #header>
            <div class="card-header">
              <div class="header-left">
                <el-icon class="header-icon"><DataAnalysis /></el-icon>
                <span class="header-title">账户状态</span>
              </div>
            </div>
          </template>
          <div class="status-item">
            <span class="status-label">账户状态</span>
            <el-tag :type="profileForm.status === 0 ? 'success' : 'danger'">
              {{ profileForm.status === 0 ? '正常' : '禁用' }}
            </el-tag>
          </div>
        </el-card>

        <!-- 账户统计卡片 -->
        <el-card class="stats-card">
          <template #header>
            <div class="card-header">
              <div class="header-left">
                <el-icon class="header-icon"><TrendCharts /></el-icon>
                <span class="header-title">账户统计</span>
              </div>
            </div>
          </template>
          <div class="stats-list">
            <div class="stat-item">
              <div class="stat-icon">
                <el-icon><Coin /></el-icon>
              </div>
              <div class="stat-content">
                <span class="stat-label">积分</span>
                <span class="stat-value">{{ profileForm.points || 0 }}</span>
              </div>
            </div>
            <div class="stat-item">
              <div class="stat-icon">
                <el-icon><TrendCharts /></el-icon>
              </div>
              <div class="stat-content">
                <span class="stat-label">学习进度</span>
                <span class="stat-value">{{ profileForm.studyProgress || 0 }}%</span>
              </div>
            </div>
            <div class="stat-item">
              <div class="stat-icon">
                <el-icon><Calendar /></el-icon>
              </div>
              <div class="stat-content">
                <span class="stat-label">注册时间</span>
                <span class="stat-value">{{ formatDateTime(profileForm.createTime) }}</span>
              </div>
            </div>
            <div class="stat-item">
              <div class="stat-icon">
                <el-icon><Clock /></el-icon>
              </div>
              <div class="stat-content">
                <span class="stat-label">最后登录</span>
                <span class="stat-value">{{ formatDateTime(profileForm.lastLoginTime) || '暂无' }}</span>
              </div>
            </div>
          </div>
        </el-card>
      </el-col>
    </el-row>

    <!-- 头像上传对话框 -->
    <el-dialog
      v-model="avatarDialogVisible"
      title="更换头像"
      width="500px"
      :close-on-click-modal="false"
    >
      <div class="avatar-upload-container">
        <!-- 当前头像预览 -->
        <div class="avatar-preview">
          <div class="preview-title">头像预览</div>
          <el-avatar
            :size="120"
            :src="getImageUrl(previewImageUrl)"
            :icon="UserFilled"
            class="preview-avatar"
          />
        </div>

        <!-- 上传区域 -->
        <div class="upload-area">
          <el-upload
            class="avatar-uploader"
            :show-file-list="false"
            :before-upload="beforeAvatarUpload"
            :http-request="handleAvatarUploadRequest"
            :loading="avatarUploading"
            drag
          >
            <div class="upload-content">
              <el-icon class="upload-icon" :class="{ 'is-loading': avatarUploading }">
                <Upload v-if="!avatarUploading" />
                <Loading v-else />
              </el-icon>
              <div class="upload-text">
                <p v-if="!avatarUploading">点击或拖拽图片到此处上传</p>
                <p v-else>上传中...</p>
              </div>
              <div class="upload-tip">
                支持 JPG、PNG、GIF 格式，文件大小不超过 5MB
              </div>
            </div>
          </el-upload>
        </div>
      </div>

      <template #footer>
        <div class="dialog-footer">
          <el-button @click="cancelAvatarChange">取消</el-button>
          <el-button
            type="primary"
            @click="confirmAvatarChange"
            :disabled="!previewImageUrl || avatarUploading"
          >
            确认更换
          </el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup>
import { ref, reactive, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import {
  User,
  UserFilled,
  Edit,
  Check,
  Close,
  Upload,
  Lock,
  Refresh,
  DataAnalysis,
  TrendCharts,
  Coin,
  Calendar,
  Clock,
  Loading
} from '@element-plus/icons-vue'
import { getUserInfo, updateProfile, changePassword } from '@/api/admin'
import { uploadImage, deleteImage } from '@/api/upload'
import { getImageUrl, handleImageError } from '@/utils/imageUtils'
import { formatDateTime } from '@/utils/datetime'

// 响应式数据
const profileFormRef = ref()
const passwordFormRef = ref()
const isEditing = ref(false)
const saving = ref(false)
const changingPassword = ref(false)

// 头像上传相关
const avatarDialogVisible = ref(false)
const avatarUploading = ref(false)
const previewImageUrl = ref('')

// 个人资料表单
const profileForm = reactive({
  id: null,
  nickname: '',
  avatarUrl: '',
  gender: 0,
  phone: '',
  email: '',
  province: '',
  city: '',
  remark: '',
  userType: 0,
  status: 0,
  points: 0,
  studyProgress: 0,
  createTime: '',
  lastLoginTime: ''
})

// 原始数据备份
const originalProfileData = reactive({})

// 密码修改表单
const passwordForm = reactive({
  currentPassword: '',
  newPassword: '',
  confirmPassword: ''
})

// 表单验证规则
const profileRules = {
  nickname: [
    { required: true, message: '请输入用户昵称', trigger: 'blur' },
    { min: 2, max: 50, message: '昵称长度在 2 到 50 个字符', trigger: 'blur' }
  ],
  phone: [
    { pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号码', trigger: 'blur' }
  ],
  email: [
    { type: 'email', message: '请输入正确的邮箱地址', trigger: 'blur' }
  ]
}

const passwordRules = {
  currentPassword: [
    { required: true, message: '请输入当前密码', trigger: 'blur' }
  ],
  newPassword: [
    { required: true, message: '请输入新密码', trigger: 'blur' },
    { min: 6, max: 20, message: '密码长度在 6 到 20 个字符', trigger: 'blur' }
  ],
  confirmPassword: [
    { required: true, message: '请再次输入新密码', trigger: 'blur' },
    {
      validator: (rule, value, callback) => {
        if (value !== passwordForm.newPassword) {
          callback(new Error('两次输入的密码不一致'))
        } else {
          callback()
        }
      },
      trigger: 'blur'
    }
  ]
}

// 获取用户信息
const fetchUserInfo = async () => {
  try {
    const response = await getUserInfo()
    if (response.code === 200) {
      Object.assign(profileForm, response.data)
      Object.assign(originalProfileData, response.data)
    } else {
      ElMessage.error(response.message || '获取用户信息失败')
    }
  } catch (error) {
    ElMessage.error('获取用户信息失败: ' + error.message)
  }
}

// 编辑资料
const handleEdit = () => {
  isEditing.value = true
}

// 保存修改
const handleSave = async () => {
  try {
    await profileFormRef.value.validate()
    saving.value = true

    const response = await updateProfile({
      nickname: profileForm.nickname,
      phone: profileForm.phone,
      email: profileForm.email,
      gender: profileForm.gender,
      province: profileForm.province,
      city: profileForm.city,
      remark: profileForm.remark
    })

    if (response.code === 200) {
      Object.assign(originalProfileData, profileForm)

      // 更新localStorage中的用户信息，同步右上角显示
      const userInfoStr = localStorage.getItem('userInfo')
      if (userInfoStr) {
        const userInfo = JSON.parse(userInfoStr)
        userInfo.nickname = profileForm.nickname
        userInfo.phone = profileForm.phone
        userInfo.email = profileForm.email
        userInfo.gender = profileForm.gender
        userInfo.province = profileForm.province
        userInfo.city = profileForm.city
        userInfo.remark = profileForm.remark
        localStorage.setItem('userInfo', JSON.stringify(userInfo))

        // 触发用户信息更新事件
        window.dispatchEvent(new CustomEvent('userInfoUpdated'))
      }

      isEditing.value = false
      ElMessage.success('个人资料更新成功')
    } else {
      ElMessage.error(response.message || '更新失败')
    }
  } catch (error) {
    if (error !== false) { // 不是表单验证错误
      ElMessage.error('更新失败: ' + error.message)
    }
  } finally {
    saving.value = false
  }
}

// 取消编辑
const handleCancel = () => {
  Object.assign(profileForm, originalProfileData)
  isEditing.value = false
}

// 头像上传
const handleAvatarUpload = () => {
  avatarDialogVisible.value = true
  previewImageUrl.value = profileForm.avatarUrl || ''
}

// 上传前验证
const beforeAvatarUpload = (file) => {
  const isImage = ['image/jpeg', 'image/jpg', 'image/png', 'image/gif'].includes(file.type)
  const isLt5M = file.size / 1024 / 1024 < 5

  if (!isImage) {
    ElMessage.error('只能上传 JPG、PNG、GIF 格式的图片!')
    return false
  }
  if (!isLt5M) {
    ElMessage.error('图片大小不能超过 5MB!')
    return false
  }
  return true
}

// 自定义头像上传
const handleAvatarUploadRequest = async (options) => {
  const { file } = options

  try {
    avatarUploading.value = true
    const response = await uploadImage(file)

    if (response.code === 200) {
      previewImageUrl.value = response.data.url
      ElMessage.success('头像上传成功')
    } else {
      ElMessage.error(response.message || '上传失败')
    }
  } catch (error) {
    console.error('头像上传失败:', error)
    ElMessage.error('头像上传失败')
  } finally {
    avatarUploading.value = false
  }
}

// 确认更换头像
const confirmAvatarChange = async () => {
  if (!previewImageUrl.value) {
    ElMessage.warning('请先上传头像')
    return
  }

  try {
    // 如果有旧头像且不是默认头像，删除旧头像
    if (profileForm.avatarUrl && profileForm.avatarUrl !== previewImageUrl.value) {
      try {
        await deleteImage(profileForm.avatarUrl)
      } catch (error) {
        console.warn('删除旧头像失败:', error)
      }
    }

    // 更新头像URL
    const updateData = {
      avatarUrl: previewImageUrl.value
    }

    const response = await updateProfile(updateData)
    if (response.code === 200) {
      profileForm.avatarUrl = previewImageUrl.value

      // 更新localStorage中的用户信息，同步右上角头像
      const userInfoStr = localStorage.getItem('userInfo')
      if (userInfoStr) {
        const userInfo = JSON.parse(userInfoStr)
        userInfo.avatarUrl = previewImageUrl.value
        localStorage.setItem('userInfo', JSON.stringify(userInfo))

        // 触发用户信息更新事件
        window.dispatchEvent(new CustomEvent('userInfoUpdated'))
      }

      avatarDialogVisible.value = false
      ElMessage.success('头像更换成功')
    } else {
      ElMessage.error(response.message || '头像更换失败')
    }
  } catch (error) {
    console.error('头像更换失败:', error)
    ElMessage.error('头像更换失败')
  }
}

// 取消头像更换
const cancelAvatarChange = () => {
  avatarDialogVisible.value = false
  previewImageUrl.value = profileForm.avatarUrl || ''
}

// 获取图片URL

// 修改密码
const handlePasswordChange = async () => {
  try {
    await passwordFormRef.value.validate()

    await ElMessageBox.confirm('确定要修改密码吗？', '确认修改', {
      type: 'warning'
    })

    changingPassword.value = true

    const response = await changePassword({
      currentPassword: passwordForm.currentPassword,
      newPassword: passwordForm.newPassword
    })

    if (response.code === 200) {
      resetPasswordForm()
      ElMessage.success('密码修改成功')
    } else {
      ElMessage.error(response.message || '密码修改失败')
    }
  } catch (error) {
    if (error !== 'cancel' && error !== false) {
      ElMessage.error('密码修改失败: ' + error.message)
    }
  } finally {
    changingPassword.value = false
  }
}

// 重置密码表单
const resetPasswordForm = () => {
  passwordForm.currentPassword = ''
  passwordForm.newPassword = ''
  passwordForm.confirmPassword = ''
  passwordFormRef.value?.clearValidate()
}

// 页面初始化
onMounted(() => {
  fetchUserInfo()

  // 调试：查看localStorage中的用户信息
  const userInfoStr = localStorage.getItem('userInfo')
  if (userInfoStr) {
    const userInfo = JSON.parse(userInfoStr)
    console.log('localStorage中的用户信息:', userInfo)
    console.log('用户头像URL:', userInfo.avatarUrl)
  }
})
</script>

<style scoped>
.profile-container {
  padding: 24px;
  background-color: #f5f7fa;
  min-height: calc(100vh - 60px);
}

.page-header {
  margin-bottom: 24px;
  padding: 0 4px;
}

.page-title {
  font-size: 28px;
  font-weight: 600;
  color: #303133;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-description {
  color: #606266;
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}

.profile-content {
  gap: 24px;
  display: flex;
  align-items: flex-start;
}

.left-column,
.right-column {
  display: flex;
  flex-direction: column;
}

.left-column {
  flex: 1;
  max-width: 66.666667%;
}

.right-column {
  flex: 0 0 33.333333%;
  max-width: 33.333333%;
}

/* 卡片样式 */
.info-card,
.password-card,
.avatar-card,
.status-card,
.stats-card {
  margin-bottom: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
  border: 1px solid #ebeef5;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-icon {
  color: #409eff;
  font-size: 16px;
}

.header-title {
  font-size: 16px;
  font-weight: 600;
  color: #303133;
}

/* 表单样式 */
.profile-form,
.password-form {
  padding: 4px;
}

.form-section {
  margin-bottom: 32px;
}

.form-section:last-of-type {
  margin-bottom: 24px;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: #606266;
  margin: 0 0 16px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #f0f2f5;
}

.form-actions {
  padding-top: 16px;
  border-top: 1px solid #f0f2f5;
  display: flex;
  gap: 12px;
}

/* 头像区域 */
.avatar-section {
  text-align: center;
  padding: 8px;
}

.avatar-display {
  margin-bottom: 16px;
}

.avatar-info {
  margin-bottom: 20px;
}

.avatar-name {
  font-size: 16px;
  font-weight: 600;
  color: #303133;
  margin: 0 0 8px 0;
}

.avatar-actions {
  display: flex;
  justify-content: center;
}

/* 状态卡片 */
.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
}

.status-label {
  font-size: 14px;
  color: #606266;
  font-weight: 500;
}

/* 统计列表 */
.stats-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background-color: #f8f9fa;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.stat-item:hover {
  background-color: #f0f2f5;
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background-color: #409eff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
}

.stat-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 12px;
  color: #909399;
  font-weight: 500;
}

.stat-value {
  font-size: 14px;
  color: #303133;
  font-weight: 600;
}

/* Element Plus 样式覆盖 */
:deep(.el-row) {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: flex-start !important;
}

:deep(.el-col) {
  flex-shrink: 0;
}

:deep(.el-form-item) {
  margin-bottom: 20px;
}

:deep(.el-form-item__label) {
  font-weight: 500;
  color: #606266;
}

:deep(.el-card__header) {
  padding: 20px 24px;
  border-bottom: 1px solid #f0f2f5;
  background-color: #fafbfc;
}

:deep(.el-card__body) {
  padding: 24px;
}

:deep(.el-input__wrapper) {
  border-radius: 6px;
}

:deep(.el-select .el-input__wrapper) {
  border-radius: 6px;
}

:deep(.el-textarea__inner) {
  border-radius: 6px;
}

:deep(.el-button) {
  border-radius: 6px;
  font-weight: 500;
}

/* 头像上传对话框 */
.avatar-upload-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.avatar-preview {
  text-align: center;
}

.preview-title {
  font-size: 16px;
  font-weight: 600;
  color: #303133;
  margin-bottom: 16px;
}

.preview-avatar {
  border: 2px solid #e4e7ed;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.upload-area {
  margin-top: 8px;
}

.avatar-uploader {
  width: 100%;
}

:deep(.avatar-uploader .el-upload) {
  width: 100%;
  border: 2px dashed #d9d9d9;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}

:deep(.avatar-uploader .el-upload:hover) {
  border-color: #409eff;
  background-color: #f5f7fa;
}

.upload-content {
  padding: 40px 20px;
  text-align: center;
}

.upload-icon {
  font-size: 48px;
  color: #c0c4cc;
  margin-bottom: 16px;
  transition: all 0.3s;
}

.upload-icon.is-loading {
  color: #409eff;
  animation: rotating 2s linear infinite;
}

@keyframes rotating {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.upload-text {
  margin-bottom: 8px;
}

.upload-text p {
  margin: 0;
  font-size: 16px;
  color: #606266;
}

.upload-tip {
  font-size: 12px;
  color: #909399;
  line-height: 1.4;
}

.dialog-footer {
  text-align: right;
}

/* 响应式设计 */
@media (max-width: 1200px) {
  .left-column {
    max-width: 60%;
  }

  .right-column {
    flex: 0 0 40%;
    max-width: 40%;
  }
}

@media (max-width: 768px) {
  .profile-container {
    padding: 16px;
  }

  .page-title {
    font-size: 24px;
  }

  .profile-content {
    flex-direction: column;
  }

  .left-column,
  .right-column {
    max-width: 100%;
    flex: none;
  }

  :deep(.el-col) {
    margin-bottom: 16px;
  }

  .form-section {
    margin-bottom: 24px;
  }

  .stats-list {
    gap: 12px;
  }

  .stat-item {
    padding: 10px;
  }

  .avatar-upload-container {
    gap: 16px;
  }

  .upload-content {
    padding: 30px 15px;
  }

  .upload-icon {
    font-size: 36px;
  }
}
</style>
